Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and clean the code #109

Merged
merged 74 commits into from
Aug 7, 2024
Merged

Refactor and clean the code #109

merged 74 commits into from
Aug 7, 2024

Conversation

TheRustifyer
Copy link
Member

@TheRustifyer TheRustifyer commented May 31, 2024

This PR aims to refactor and clean the code written so far in Zork++ before introduce new features.

Some of the core ideas is:

  • Re-design the cache to have the latest generated commands and the latest iterations, by demoting the last entry and the consecutive entries (deleting the container) and relate the iterations via the execution status designed for the purpose
  • Cache the generated ProjectModel for every ConfigurationFile so we can avoid remap them on every program iteration
  • Refactor de parts of the project_model that uses owned data to use the clone-on-write idiom
  • As above, use Cow as the inner type of Argument, but this means to introduce lifetimes bounds for the whole codebase, so we may see if it's worth the effort
  • Add unit and doc test (specially this latest ones) in the methods that aren't exactly easy to read, so when we come back to the project after a long period of inactivity is easier to understand
  • Related to the latest one, we should refactor those procedures that has a lot of cognitive complexity without need it
  • Make a named entry for the commands generated for build the modular implementations of the standard libraries (std and std.compat)
  • Make a better architecture over the structs that holds data on the Cache
  • Introduce different clean cache levels (-c only forces to execute already cached commands, -cc wipes the cache entry)
  • Use the toml crate on the latest version, the one that brokes the non-owned types compatibilities, and solve the performance downgrade by completely cache the configuration files, as well as the project model if there's no changes over the translation units or the configuration options
  • Add a workflow for Windows with the MSYS2 project, so we can run integration tests against GCC on Windows on the GitHub actions
  • Remove the extra_args property from the Modules entities

NOTE: Some code comments are on Spanish in this initial commit, used to just set up this upstream branch. Sorry about that, English readers.

@TheRustifyer TheRustifyer self-assigned this May 31, 2024
feat: removed the cache last generated commands, so they're one only one entity
feat: reworked the conversion from our cache to the compile_commands.json format
feat: unified the serialization and serialization entities. The intermediate ones used to clone data from the non-owned version of the cache has been deleted, and the SourceCommandLine now only works with owned data, so there's no need anymore to use those intermediate data mappers (that already was cloning from borrowed data)
…t and common Argument(s) that only need to be created once
…instead of owned data. Code compiles but is far from finished yet
… if they are already built if there's no header declared by the user. This closes #116
…tionUnit

fix: we can't use join for file_stem(s) that contains dots in their names, since it skips anything after the first point
…nership is transferred to the build_model procedure
…nership is transferred to the build_model procedure

fix: changed back the types on the config file data structures to their original reference types
…ommands within the domain on the project files
chore: refactored the .collect() calls on the chained iterators to just
use an opaque type behind the Iterator type and avoid to consume the
view of the command line arguments
This bug was causing to fail the linkage step, since the linker was
receiving a ::default()(ed) Argument, which evaluates to ""
…ake the user's declared files easier to read, reducing the amount of directories per file that should be passed to the configuration file
…ine of every target, since GCC handles the references to the modules via gcm.cache
… command line, deleted by mistake (too much v-dd)
Copy link
Member

@gbm25 gbm25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have seen the tests and everything seemed to work correctly.
Approved!

@TheRustifyer
Copy link
Member Author

Everything ready to merge to main.
@gbm25 ping for approval
This closes #110

@TheRustifyer TheRustifyer merged commit e979c6a into main Aug 7, 2024
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment